]> permondes.de Git - Analog_Engine.git/blame - scripts/TP1 04.12 Harmonic Oscillator.AESL
a rope slides frictionlessly down the edge of a table
[Analog_Engine.git] / scripts / TP1 04.12 Harmonic Oscillator.AESL
CommitLineData
6e8a1392
P
1IDENTIFICATION DIVISION
2PROGRAM-ID HarmonicOscillator
3VERSION 20240201
4COMMENT A mass m is subject to a force F=-k*r.
5COMMENT What is the trajectory if the mass starts at position (a,0,0)?
6COMMENT How much time does it take to pass through zero?
7COMMENT What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
8COMMENT m*x'' = -k*x
9COMMENT m*y'' = -k*y (z can be set to 0).
10
11ENVIRONMENT DIVISION
12ENGINE Anabrid-THAT
13TIMEBASE 1ms
14REQUIRES COEFFICIENT 4, INTEGRATOR 4, INVERTER 2
15
16DATA DIVISION
17OUTPUT OUTPUT.X x
18OUTPUT OUTPUT.Y y
19COEFFICIENT.1 A # (a,0,0)
20COEFFICIENT.2 K/M_x # k/m for x
21COEFFICIENT.3 V0 # (0,v0,0)
22COEFFICIENT.4 K/M_y # k/m for y, identical to k/m for x
23
24PROGRAM DIVISION
25-1 -> COEFFICIENT.A -> -a # has to be negative because x' is negative
26+1 -> COEFFICIENT.V0 -> v0 # has to be positive because y'' is positive
27
28x'' -> INTEGRATOR -> -x'
29-x', IC:-a -> INTEGRATOR -> x
30x -> COEFFICIENT.K/M_x -> k/m*x
31k/m*x -> INVERTER -> -k/m*x = x''
32
33y'', IC:v0 -> INTEGRATOR -> -y'
34-y' -> INTEGRATOR -> y
35y -> COEFFICIENT.K/M_y -> k/m*y
36k/m*y -> INVERTER -> -k/m*y = y''
37
38OPERATION DIVISION
39MODE REPEAT
40OP-TIME 100 ms